import * as json1 from './movies.json';
import json2 from './movies';

export function testJson() {
	_useJsonFormat();
	_useJSForFormat();
}

function _useJsonFormat() {
	// style1: no tip
	var tmp = json1.default;
	console.log(tmp);
	console.log(tmp.title);
	console.log(tmp.movies.length);
	console.log(tmp.movies[0].title);

	// add item
	tmp['n1'] = 10;
	console.log('n1', tmp.n1);
	// tmp1['list'] = [10, 20, 30];
	tmp['list'] = [];
	tmp['list'].push(10);
	tmp['list'].push(20);
	tmp['list'].push(30);
	console.log('list', tmp.list);
}

function _useJSForFormat() {
	console.log('_useJSForFormat');
	// style2 : has auto tip
	var tmp = json2;
	console.log(tmp.title);
	console.log(tmp.movies.length);
	console.log(tmp.movies[0].title);

	// add item
	tmp.n1 = 10;
	console.log('n1', tmp.n1);
	// tmp1['list'] = [10, 20, 30];
	tmp.list = [];
	tmp.list.push(10);
	tmp.list.push(20);
	tmp.list.push(30);
	console.log('list', tmp.list);
}
